package model;

import java.util.ArrayList;
import java.util.GregorianCalendar;

public class PN extends Prescription {

	private double countOfUnits;
	private ArrayList<GregorianCalendar> doseDays = new ArrayList<GregorianCalendar>();

	public PN(GregorianCalendar startDate, GregorianCalendar endDate, double count) {
		super(startDate, endDate);
		countOfUnits = count;
	}
	
	public void addDose(GregorianCalendar date){
		doseDays.add(date);
	}

	/*
	 * Checks if a dose has been given on the supplied date.
	 * Returns a boolean.
	 */
	public boolean doseGiven(GregorianCalendar givenDate) {
		return doseDays.contains(givenDate);
	}

	public int getNumberOfTimesGiven() {
		return doseDays.size();
	}

	public double getCountOfUnits() {
		return countOfUnits;
	}

	@Override
	public double dayDose() {
		return totalDose() / dayCount();
	}

	@Override
	public double totalDose() {
		return getCountOfUnits() * getNumberOfTimesGiven(); // Return the number of dose units for all days.
	}
	
	// to match the diagram.
	public double given() {
		return totalDose();
	}
}
